import React, { useEffect, useState } from 'react'

export default function App() {
   const [time , setTime]  = useState(0);
   const [isHot , setIsHot] = useState(true);
   useEffect(() => {
    console.log('现在的时间' + time);
   },[time])
   useEffect(() => {
    console.log('现在的天气');
   },[isHot])
  return (
    <div>
        <h1>现在时间{time}</h1>
        <button onClick = {() => {setTime(time + 1)}}>点击加一</button>
        <hr />
        <h2>今天的天气:{isHot ? '晴天' : '有大雨'}</h2>
        <button onClick = {() => {setIsHot(!isHot)}}>切换天气</button>
    </div>
  )
}
